﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Master/Default.master" AutoEventWireup="true"
    CodeBehind="signin.aspx.cs" Inherits="SocialShare.Web.signin" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <%--Facebook connect start --%>
    <input id="hidEmail" type="hidden" runat="server" />
    <input id="hidFirstName" type="hidden" runat="server" />
    <input id="hidLastName" type="hidden" runat="server" />
    <input id="hidUID" type="hidden" runat="server" />
    <input id="hidUserName" type="hidden" runat="server" />
    <div id="fb-root">
    </div>
    <%--Facebook connect end --%>
    <section id="divMessage" runat="server" class="notice">
        <asp:Literal ID="lblMessage" runat="server" Text="Join now for FREE!* Not a member? Registration is a snap!"></asp:Literal>
    </section>
    <section class="grid_6">
        <h2 class="title-regular">Register as new user</h2>
        <p id="newUser">
            <label for="name">
                Screen Name:</label>
            <br />
            <input type="text" id="txtName" name="txtName" runat="server" placeholder="Name" class="text" />
            <asp:RequiredFieldValidator ID="rfvtxtName" ControlToValidate="txtName" SetFocusOnError="true" runat="server" ErrorMessage="*" Display="Dynamic" CssClass="required-field" ValidationGroup="valgrpRegister"></asp:RequiredFieldValidator>
            <br />
            <label for="email">
                Email [used as username]:</label>
            <br />
            <input type="text" id="txtEmail" name="txtEmail" runat="server" placeholder="email@example.com" class="text" />
           <asp:RequiredFieldValidator ID="rfvtxtEmail" ControlToValidate="txtEmail" SetFocusOnError="true" runat="server" ErrorMessage="*" Display="Dynamic" CssClass="required-field" ValidationGroup="valgrpRegister"></asp:RequiredFieldValidator>
           
           
              <br />
            <input type="checkbox" id="chkAcceptTerms" />
             I certify that I have read the Terms and Conditions and accept them. 
             <br />
               <br />
            <asp:Button ID="btnRegister" runat="server" Text="Sign Up" CssClass="button small blue" onclick="btnRegister_Click" ValidationGroup="valgrpRegister" />
            <%--Facebook connect start --%>
            <fb:login-button perms="email,user_photos" size="large" length="long">Register with Facebook</fb:login-button>
            <section style="visibility:hidden;">
            <asp:Button ID="btnRegFB" runat="server" Text="FB Reg" onclick="btnRegFB_Click"></asp:Button>
            </section>
            <%--Facebook connect start --%>
        </p>
        </section>
    <section class="grid_6">
        <h2 class="title-regular">Sign In as existing user</h2>
        <p id="siteUser">
            <label for="email">
                UserName:</label>
            <br />
            <input type="text" id="txtUserName" runat="server" name="txtUserName" placeholder="email@example.com" class="text"  />
            <asp:RequiredFieldValidator ID="rfvtxtUserName" ControlToValidate="txtUserName" SetFocusOnError="true" runat="server" ErrorMessage="*" Display="Dynamic" CssClass="required-field" ValidationGroup="valgrpLogin"></asp:RequiredFieldValidator>
            <br />
            <label for="password">
                Password:</label>
            <br />
            <input type="password" id="txtPassword" runat="server" name="txtPassword" class="text" />
            <asp:RequiredFieldValidator ID="rfvtxtPassword" ControlToValidate="txtPassword" SetFocusOnError="true" runat="server" ErrorMessage="*" Display="Dynamic" CssClass="required-field" ValidationGroup="valgrpLogin"></asp:RequiredFieldValidator>
            <br />
            <asp:CheckBox ID="chkRememberMe" runat="server" Text="Remember Me"></asp:CheckBox>
            <br /><br />
            <asp:Button ID="btnSignIn" runat="server" Text="Sign In" CssClass="button small green" onclick="btnSignIn_Click" ValidationGroup="valgrpLogin" />
           
            
        </p>
        </section>
    <%--Facebook connect start --%>
    <script src="http://connect.facebook.net/en_US/all.js" type="text/javascript"></script>
    <script type="text/javascript">
        FB.init({ appId: '217291921645976', status: true, cookie: true, xfbml: true });
        FB.Event.subscribe('auth.sessionChange', function (response) {
            if (response.session) {
                FB.api('/me', function (response) {
                    $("#<%=hidEmail.ClientID %>").val(response.email);
                    $("#<%=hidFirstName.ClientID %>").val(response.first_name);
                    $("#<%=hidLastName.ClientID %>").val(response.last_name);
                    $("#<%=hidUID.ClientID %>").val(response.id);
                    $("#<%=hidUserName.ClientID %>").val(response.username);
                    $("#<%= btnRegFB.ClientID %>").click();
                });

            } else {
                // The user has logged out, and the cookie has been cleared
            }
        });
        function LoginWithFB() {
            $("#<%= btnRegFB.ClientID %>").click();
        }
    </script>
    <%--Facebook connect end --%>
</asp:Content>
